!function(y,O,i,e){var n,I,a,s,l,o,r,c,u,h,t,g,f="mPageScroll2id",x="mPS2id",d={scrollSpeed:1e3,autoScrollSpeed:!0,scrollEasing:"easeInOutQuint",scrollingEasing:"easeOutQuint",pageEndSmoothScroll:!0,layout:"vertical",offset:0,highlightSelector:!1,clickedClass:x+"-clicked",targetClass:x+"-target",highlightClass:x+"-highlight",forceSingleHighlight:!1,keepHighlightUntilNext:!1,highlightByNextTarget:!1,disablePluginBelow:!1,clickEvents:!0,appendHash:!1,onStart:function(){},onComplete:function(){},defaultSelector:!1,live:!0,liveSelector:!1},p=0,_={init:function(e){e=y.extend(!0,{},d,e);if(y(i).data(x,e),I=y(i).data(x),!this.selector){var t="__"+x;this.each(function(){var e=y(this);e.hasClass(t)||e.addClass(t)}),this.selector="."+t}I.liveSelector&&(this.selector+=","+I.liveSelector),n=n?n+","+this.selector:this.selector,I.defaultSelector&&("object"==typeof y(n)&&0!==y(n).length||(n=".m_PageScroll2id,a[rel~='m_PageScroll2id'],.page-scroll-to-id,a[rel~='page-scroll-to-id'],._ps2id")),I.clickEvents&&y(i).undelegate("."+x).delegate(n,"click."+x,function(e){if(m._isDisabled.call(null))m._removeClasses.call(null);else{var t=y(this),n=t.attr("href"),a=t.prop("href").baseVal||t.prop("href");n&&-1!==n.indexOf("#/")||(m._reset.call(null),h=t.data("ps2id-offset")||0,m._isValid.call(null,n,a)&&m._findTarget.call(null,n)&&(e.preventDefault(),s="selector",l=t,m._setClasses.call(null,!0),m._scrollTo.call(null)))}}),y(O).unbind("."+x).bind("scroll."+x+" resize."+x,function(){if(m._isDisabled.call(null))m._removeClasses.call(null);else{var s=y("._"+x+"-t");s.each(function(e){var t=y(this),n=t.attr("id"),a=m._findHighlight.call(null,n);m._setClasses.call(null,!1,t,a),e==s.length-1&&m._extendClasses.call(null)})}}),a=!0,m._setup.call(null),m._live.call(null)},scrollTo:function(e,t){if(m._isDisabled.call(null))m._removeClasses.call(null);else if(e&&void 0!==e){m._isInit.call(null);var n={layout:I.layout,offset:I.offset,clicked:!1};t=y.extend(!0,{},n,t);m._reset.call(null),c=t.layout,u=t.offset,e=-1!==e.indexOf("#")?e:"#"+e,m._isValid.call(null,e)&&m._findTarget.call(null,e)&&(s="scrollTo",(l=t.clicked)&&m._setClasses.call(null,!0),m._scrollTo.call(null))}},destroy:function(){y(O).unbind("."+x),y(i).undelegate("."+x).removeData(x),y("._"+x+"-t").removeData(x),m._removeClasses.call(null,!0)}},m={_isDisabled:function(){var e=O,t="inner",n=I.disablePluginBelow instanceof Array?[I.disablePluginBelow[0]||0,I.disablePluginBelow[1]||0]:[I.disablePluginBelow||0,0];return"innerWidth"in O||(t="client",e=i.documentElement||i.body),e[t+"Width"]<=n[0]||e[t+"Height"]<=n[1]},_isValid:function(e,t){if(e){var n=-1!==(t=t||e).indexOf("#/")?t.split("#/")[0]:t.split("#")[0],a=O.location.toString().split("#")[0];return"#"!==e&&-1!==e.indexOf("#")&&(""===n||decodeURIComponent(n)===decodeURIComponent(a))}},_setup:function(){var l=m._highlightSelector(),o=1,r=0;return y(l).each(function(){var e=y(this),t=e.attr("href"),n=e.prop("href").baseVal||e.prop("href");if(m._isValid.call(null,t,n)){var a=-1!==t.indexOf("#/")?t.split("#/")[1]:t.split("#")[1],s=y("#"+a);if(0=o&&a.top<=l&&a.left>=c&&a.left<=r}var u=y(O).height(),h=y(O).width(),g=n?y(n).height():e.height(),f=n?y(n).width():e.width(),d=1+g/u,p=d,_=g=u/_,a.left<=h/v,a.right>=h/S];if(I.highlightByNextTarget){var w=e.data(x).tn;if(w){var b=w[0].getBoundingClientRect();"vertical"===I.layout?C=[a.top<=u/2,b.top>u/2,1,1]:"horizontal"===I.layout&&(C=[1,1,a.left<=h/2,b.left>h/2])}}return C[0]&&C[1]&&C[2]&&C[3]},_scrollTo:function(){g=m._scrollSpeed.call(null),r=I.pageEndSmoothScroll?m._pageEndSmoothScroll.call(null):r;var e=y("html,body"),t=I.autoScrollSpeed?m._autoScrollSpeed.call(null):g,n=e.is(":animated")?I.scrollingEasing:I.scrollEasing,a=y(O).scrollTop(),s=y(O).scrollLeft();switch(c){case"horizontal":s!=r[1]&&(m._callbacks.call(null,"onStart"),e.stop().animate({scrollLeft:r[1]},t,n).promise().then(function(){m._callbacks.call(null,"onComplete")}));break;case"auto":var i;if(a!=r[0]||s!=r[1])if(m._callbacks.call(null,"onStart"),navigator.userAgent.match(/(iPod|iPhone|iPad|Android)/))e.stop().animate({pageYOffset:r[0],pageXOffset:r[1]},{duration:t,easing:n,step:function(e,t){"pageXOffset"==t.prop?i=e:"pageYOffset"==t.prop&&O.scrollTo(i,e)}}).promise().then(function(){m._callbacks.call(null,"onComplete")});else e.stop().animate({scrollTop:r[0],scrollLeft:r[1]},t,n).promise().then(function(){m._callbacks.call(null,"onComplete")});break;default:a!=r[0]&&(m._callbacks.call(null,"onStart"),e.stop().animate({scrollTop:r[0]},t,n).promise().then(function(){m._callbacks.call(null,"onComplete")}))}},_pageEndSmoothScroll:function(){var e=y(i).height(),t=y(i).width(),n=y(O).height(),a=y(O).width();return[e-r[0] a[href*='#'],a.ps2id[href*='#']";l(document).ready(function(){for(var e=0;e");return!!a&&(">"===a.substr(0,1)?l(e).width()>a.substr(1):"<"===a.substr(0,1)?l(e).width()");return!!a&&(">"===a.substr(0,1)?l(e).height()>a.substr(1):"<"===a.substr(0,1)?l(e).height()0&&n.is(":hidden")&&(o.one("click.superfish",!1),"MSPointerDown"===s.type?o.trigger("focus"):e.proxy(u,o.parent("li"))())},u=function(){var s=e(this),o=d(s);clearTimeout(o.sfTimer),s.siblings().superfish("hide").end().superfish("show")},p=function(){var s=e(this),n=d(s);o?e.proxy(f,s,n)():(clearTimeout(n.sfTimer),n.sfTimer=setTimeout(e.proxy(f,s,n),n.delay))},f=function(s){s.retainPath=e.inArray(this[0],s.$path)>-1,this.superfish("hide"),this.parents("."+s.hoverClass).length||(s.onIdle.call(c(this)),s.$path.length&&e.proxy(u,s.$path)())},c=function(e){return e.closest("."+s.menuClass)},d=function(e){return c(e).data("sf-options")};return{hide:function(s){if(this.length){var o=this,n=d(o);if(!n)return this;var t=n.retainPath===!0?n.$path:"",i=o.find("li."+n.hoverClass).add(this).not(t).removeClass(n.hoverClass).children(n.popUpSelector),r=n.speedOut;s&&(i.show(),r=0),n.retainPath=!1,n.onBeforeHide.call(i),i.stop(!0,!0).animate(n.animationOut,r,function(){var s=e(this);n.onHide.call(s)})}return this},show:function(){var e=d(this);if(!e)return this;var s=this.addClass(e.hoverClass),o=s.children(e.popUpSelector);return e.onBeforeShow.call(o),o.stop(!0,!0).animate(e.animation,e.speed,function(){e.onShow.call(o)}),this},destroy:function(){return this.each(function(){var o,n=e(this),i=n.data("sf-options");return i?(o=n.find(i.popUpSelector).parent("li"),clearTimeout(i.sfTimer),t(n,i),r(o),a(n),n.off(".superfish").off(".hoverIntent"),o.children(i.popUpSelector).attr("style",function(e,s){return s.replace(/display[^;]+;?/g,"")}),i.$path.removeClass(i.hoverClass+" "+s.bcClass).addClass(i.pathClass),n.find("."+i.hoverClass).removeClass(i.hoverClass),i.onDestroy.call(n),n.removeData("sf-options"),void 0):!1})},init:function(o){return this.each(function(){var n=e(this);if(n.data("sf-options"))return!1;var h=e.extend({},e.fn.superfish.defaults,o),u=n.find(h.popUpSelector).parent("li");h.$path=i(n,h),n.data("sf-options",h),t(n,h),r(u),a(n),l(n,h),u.not("."+s.bcClass).superfish("hide",!0),h.onInit.call(this)})}}}();e.fn.superfish=function(o){return s[o]?s[o].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof o&&o?e.error("Method "+o+" does not exist on jQuery.fn.superfish"):s.init.apply(this,arguments)},e.fn.superfish.defaults={popUpSelector:"ul,.sf-mega",hoverClass:"sfHover",pathClass:"overrideThisToUse",pathLevels:1,delay:800,animation:{opacity:"show"},animationOut:{opacity:"hide"},speed:"normal",speedOut:"fast",cssArrows:!0,disableHI:!1,onInit:e.noop,onBeforeShow:e.noop,onShow:e.noop,onBeforeHide:e.noop,onHide:e.noop,onIdle:e.noop,onDestroy:e.noop},e.fn.extend({hideSuperfishUl:s.hide,showSuperfishUl:s.show})})(jQuery); if(typeof THEMEREX_GLOBALS=='undefined') var THEMEREX_GLOBALS={}; function themerex_get_global(var_name){ return themerex_isset(THEMEREX_GLOBALS[var_name]) ? THEMEREX_GLOBALS[var_name]:''; } function themerex_set_global(var_name, value){ THEMEREX_GLOBALS[var_name]=value; } function themerex_inc_global(var_name){ var value=arguments[1]==undefined ? 1:arguments[1]; THEMEREX_GLOBALS[var_name] +=value; } function themerex_concat_global(var_name, value){ THEMEREX_GLOBALS[var_name] +=''+value; } function themerex_get_global_array(var_name, key){ return themerex_isset(THEMEREX_GLOBALS[var_name][key]) ? THEMEREX_GLOBALS[var_name][key]:''; } function themerex_set_global_array(var_name, key, value){ if(!themerex_isset(THEMEREX_GLOBALS[var_name])) THEMEREX_GLOBALS[var_name]={}; THEMEREX_GLOBALS[var_name][key]=value; } function themerex_inc_global_array(var_name, key){ var value=arguments[2]==undefined ? 1:arguments[2]; THEMEREX_GLOBALS[var_name][key] +=value; } function themerex_concat_global_array(var_name, key, value){ THEMEREX_GLOBALS[var_name][key] +=''+value; } function themerex_isset(obj){ return obj!=undefined; } function themerex_empty(obj){ return obj==undefined||(typeof(obj)=='object'&&obj==null)||(typeof(obj)=='array'&&obj.length==0)||(typeof(obj)=='string'&&themerex_alltrim(obj)==''); } function themerex_is_array(obj){ "use strict"; return typeof(obj)=='array'; } function themerex_is_object(obj){ "use strict"; return typeof(obj)=='object'; } function themerex_in_array(val, thearray){ "use strict"; var rez=false; for (var i=0; i=0; i--){ if(str.substr(i,1)!=' '){ end=i; break; }} } return str.substring(start, end+1); } function themerex_ltrim(str){ "use strict"; return themerex_alltrim(str, 'l'); } function themerex_rtrim(str){ "use strict"; return themerex_alltrim(str, 'r'); } function themerex_padl(str, len){ "use strict"; var ch=arguments[2] ? arguments[2]:' '; var rez=str.substr(0,len); if(rez.length < len){ for (var i=0; i0) decimals--; var ch=num.substr(i,1); if(ch=='.'){ if(precision>0){ res +=ch; } decimals=precision; }else if((ch>=0&&ch<=9)||(ch=='-'&&i==0)) res+=ch; } if(precision>0&&decimals!=0){ if(decimals==-1){ res +='.'; decimals=precision; } for (i=decimals; i>0; i--) res +='0'; } return res; } function themerex_dec2hex(n){ "use strict"; return Number(n).toString(16); } function themerex_hex2dec(hex){ "use strict"; return parseInt(hex,16); } function themerex_sort_array(thearray){ "use strict"; var caseSensitive=arguments[1] ? arguments[1]:false; for (var x=0; x thearray[y]){ tmp=thearray[x]; thearray[x]=thearray[y]; thearray[y]=tmp; }}else{ if(thearray[x].toLowerCase() > thearray[y].toLowerCase()){ tmp=thearray[x]; thearray[x]=thearray[y]; thearray[y]=tmp; }} }} return thearray; } function themerex_parse_date(dt){ "use strict"; dt=dt.replace(/\//g, '-').replace(/\./g, '-').replace(/T/g, ' ').split('+')[0]; var dt2=dt.split(' '); var d=dt2[0].split('-'); var t=dt2[1].split(':'); d.push(t[0], t[1], t[2]); return d; } function themerex_get_date_difference(dt1){ "use strict"; var dt2=arguments[1]!==undefined ? arguments[1]:''; var short_date=arguments[2]!==undefined ? arguments[2]:true; var sec=arguments[3]!==undefined ? arguments[3]:false; var a1=themerex_parse_date(dt1); dt1=Date.UTC(a1[0], a1[1], a1[2], a1[3], a1[4], a1[5]); if(dt2==''){ dt2=new Date(); var a2=[dt2.getFullYear(), dt2.getMonth()+1, dt2.getDate(), dt2.getHours(), dt2.getMinutes(), dt2.getSeconds()]; } else var a2=themerex_parse_date(dt2); dt2=Date.UTC(a2[0], a2[1], a2[2], a2[3], a2[4], a2[5]); var diff=Math.round((dt2 - dt1)/1000); var days=Math.floor(diff / (24*3600)); diff -=days * 24 * 3600; var hours=Math.floor(diff / 3600); diff -=hours * 3600; var minutes=Math.floor(diff / 60); diff -=minutes * 60; rez=''; if(days > 0) rez +=(rez!='' ? ' ':'') + days + ' day' + (days > 1 ? 's':''); if((!short_date||rez=='')&&hours > 0) rez +=(rez!='' ? ' ':'') + hours + ' hour' + (hours > 1 ? 's':''); if((!short_date||rez=='')&&minutes > 0) rez +=(rez!='' ? ' ':'') + minutes + ' minute' + (minutes > 1 ? 's':''); if(sec||rez=='') rez +=rez!=''||sec ? (' ' + diff + ' second' + (diff > 1 ? 's':'')):'less then minute'; return rez; } function themerex_hex2rgb(hex){ hex=parseInt(((hex.indexOf('#') > -1) ? hex.substring(1):hex), 16); return {r: hex >> 16, g: (hex & 0x00FF00) >> 8, b: (hex & 0x0000FF)};} function themerex_rgb2hex(color){ "use strict"; var aRGB; color=color.replace(/\s/g,"").toLowerCase(); if(color=='rgba(0,0,0,0)'||color=='rgba(0%,0%,0%,0%)') color='transparent'; if(color.indexOf('rgba(')==0) aRGB=color.match(/^rgba\((\d{1,3}[%]?),(\d{1,3}[%]?),(\d{1,3}[%]?),(\d{1,3}[%]?)\)$/i); else aRGB=color.match(/^rgb\((\d{1,3}[%]?),(\d{1,3}[%]?),(\d{1,3}[%]?)\)$/i); if(aRGB){ color=''; for (var i=1; i<=3; i++) color +=Math.round((aRGB[i][aRGB[i].length-1]=="%"?2.55:1)*parseInt(aRGB[i])).toString(16).replace(/^(.)$/,'0$1'); } else color=color.replace(/^#?([\da-f])([\da-f])([\da-f])$/i, '$1$1$2$2$3$3'); return (color.substr(0,1)!='#' ? '#':'') + color; } function themerex_components2hex(r,g,b){ "use strict"; return '#'+ Number(r).toString(16).toUpperCase().replace(/^(.)$/,'0$1') + Number(g).toString(16).toUpperCase().replace(/^(.)$/,'0$1') + Number(b).toString(16).toUpperCase().replace(/^(.)$/,'0$1'); } function themerex_rgb2components(color){ "use strict"; color=themerex_rgb2hex(color); var matches=color.match(/^#?([\dabcdef]{2})([\dabcdef]{2})([\dabcdef]{2})$/i); if(!matches) return false; for (var i=1, rgb=new Array(3); i<=3; i++) rgb[i-1]=parseInt(matches[i],16); return rgb; } function themerex_hex2hsb(hex){ "use strict"; return themerex_rgb2hsb(themerex_hex2rgb(hex)); } function themerex_hsb2hex(hsb){ var rgb=themerex_hsb2rgb(hsb); return themerex_components2hex(rgb.r, rgb.g, rgb.b); } function themerex_rgb2hsb(rgb){ "use strict"; var hsb={}; hsb.b=Math.max(Math.max(rgb.r,rgb.g),rgb.b); hsb.s=(hsb.b <=0) ? 0:Math.round(100*(hsb.b - Math.min(Math.min(rgb.r,rgb.g),rgb.b))/hsb.b); hsb.b=Math.round((hsb.b /255)*100); if((rgb.r==rgb.g)&&(rgb.g==rgb.b)) hsb.h=0; else if(rgb.r>=rgb.g&&rgb.g>=rgb.b) hsb.h=60*(rgb.g-rgb.b)/(rgb.r-rgb.b); else if(rgb.g>=rgb.r&&rgb.r>=rgb.b) hsb.h=60 + 60*(rgb.g-rgb.r)/(rgb.g-rgb.b); else if(rgb.g>=rgb.b&&rgb.b>=rgb.r) hsb.h=120 + 60*(rgb.b-rgb.r)/(rgb.g-rgb.r); else if(rgb.b>=rgb.g&&rgb.g>=rgb.r) hsb.h=180 + 60*(rgb.b-rgb.g)/(rgb.b-rgb.r); else if(rgb.b>=rgb.r&&rgb.r>=rgb.g) hsb.h=240 + 60*(rgb.r-rgb.g)/(rgb.b-rgb.g); else if(rgb.r>=rgb.b&&rgb.b>=rgb.g) hsb.h=300 + 60*(rgb.r-rgb.b)/(rgb.r-rgb.g); else hsb.h=0; hsb.h=Math.round(hsb.h); return hsb; } function themerex_hsb2rgb(hsb){ var rgb={}; var h=Math.round(hsb.h); var s=Math.round(hsb.s*255/100); var v=Math.round(hsb.b*255/100); if(s==0){ rgb.r=rgb.g=rgb.b=v; }else{ var t1=v; var t2=(255-s)*v/255; var t3=(t1-t2)*(h%60)/60; if(h==360) h=0; if(h<60){ rgb.r=t1; rgb.b=t2; rgb.g=t2+t3; } else if(h<120){ rgb.g=t1; rgb.b=t2; rgb.r=t1-t3; } else if(h<180){ rgb.g=t1; rgb.r=t2; rgb.b=t2+t3; } else if(h<240){ rgb.b=t1; rgb.r=t2; rgb.g=t1-t3; } else if(h<300){ rgb.b=t1; rgb.g=t2; rgb.r=t2+t3; } else if(h<360){ rgb.r=t1; rgb.g=t2; rgb.b=t1-t3; }else{ rgb.r=0; rgb.g=0; rgb.b=0; }} return { r:Math.round(rgb.r), g:Math.round(rgb.g), b:Math.round(rgb.b) };} function themerex_color_picker(){ "use strict"; var id=arguments[0] ? arguments[0]:"iColorPicker"+Math.round(Math.random()*1000); var colors=arguments[1] ? arguments[1] : '#f00,#ff0,#0f0,#0ff,#00f,#f0f,#fff,#ebebeb,#e1e1e1,#d7d7d7,#cccccc,#c2c2c2,#b7b7b7,#acacac,#a0a0a0,#959595,' +'#ee1d24,#fff100,#00a650,#00aeef,#2f3192,#ed008c,#898989,#7d7d7d,#707070,#626262,#555,#464646,#363636,#262626,#111,#000,' +'#f7977a,#fbad82,#fdc68c,#fff799,#c6df9c,#a4d49d,#81ca9d,#7bcdc9,#6ccff7,#7ca6d8,#8293ca,#8881be,#a286bd,#bc8cbf,#f49bc1,#f5999d,' +'#f16c4d,#f68e54,#fbaf5a,#fff467,#acd372,#7dc473,#39b778,#16bcb4,#00bff3,#438ccb,#5573b7,#5e5ca7,#855fa8,#a763a9,#ef6ea8,#f16d7e,' +'#ee1d24,#f16522,#f7941d,#fff100,#8fc63d,#37b44a,#00a650,#00a99e,#00aeef,#0072bc,#0054a5,#2f3192,#652c91,#91278f,#ed008c,#ee105a,' +'#9d0a0f,#a1410d,#a36209,#aba000,#588528,#197b30,#007236,#00736a,#0076a4,#004a80,#003370,#1d1363,#450e61,#62055f,#9e005c,#9d0039,' +'#790000,#7b3000,#7c4900,#827a00,#3e6617,#045f20,#005824,#005951,#005b7e,#003562,#002056,#0c004b,#30004a,#4b0048,#7a0045,#7a0026'; var colorsList=colors.split(','); var tbl=''; for (var i=0; i0 ? '':'') + ''; tbl +=''; } tbl +='' + '' + '' + '' + '
 
' + '' + '' + '' + '' + '
'; jQuery(document.createElement("div")) .attr("id", id) .css('display','none') .html(tbl) .appendTo("body") .addClass("iColorPickerTable") .on('mouseover', 'thead td', function(){ "use strict"; var aaa=themerex_rgb2hex(jQuery(this).css('background-color')); jQuery('#'+id+'_colorPreview').css('background',aaa); jQuery('#'+id+'_colorPreview input').val(aaa); }) .on('keypress', '#'+id+'_colorPreview input', function(key){ "use strict"; var aaa=jQuery(this).val() if(aaa.length<7&&((key.which>=48&&key.which<=57)||(key.which>=97&&key.which<=102)||(key.which===35||aaa.length===0))){ aaa +=String.fromCharCode(key.which); }else if(key.which==8&&aaa.length>0){ aaa=aaa.substring(0, aaa.length-1); }else if(key.which===13&&(aaa.length===4||aaa.length===7)){ var fld=jQuery('#'+id).data('field'); var func=jQuery('#'+id).data('func'); if(func!=null&&func!='undefined'){ func(fld, aaa); }else{ fld.val(aaa).css('backgroundColor', aaa).trigger('change'); } jQuery('#'+id+'_Bg').fadeOut(500); jQuery('#'+id).fadeOut(500); }else{ key.preventDefault(); return false; } if(aaa.substr(0,1)==='#'&&(aaa.length===4||aaa.length===7)){ jQuery('#'+id+'_colorPreview').css('background',aaa); }}) .on('click', 'thead td', function(e){ "use strict"; var fld=jQuery('#'+id).data('field'); var func=jQuery('#'+id).data('func'); var aaa=themerex_rgb2hex(jQuery(this).css('background-color')); if(func!=null&&func!='undefined'){ func(fld, aaa); }else{ fld.val(aaa).css('backgroundColor', aaa).trigger('change'); } jQuery('#'+id+'_Bg').fadeOut(500); jQuery('#'+id).fadeOut(500); e.preventDefault(); return false; }) .on('click', 'tbody .iColorPicker_moreColors', function(e){ "use strict"; var thead=jQuery(this).parents('table').find('thead'); var out=''; if(thead.hasClass('more_colors')){ for (var i=0; i0 ? '':'') + ''; out +=' '; } thead.removeClass('more_colors').empty().html(out+''); jQuery('#'+id+'_colorPreview').attr('colspan', 8); jQuery('#'+id+'_colorOriginal').attr('colspan', 8); }else{ var rgb=[0,0,0], i=0, j=-1; while (rgb[0]<0xF||rgb[1]<0xF||rgb[2]<0xF){ if(i%18==0) out +=(i>0 ? '':'') + ''; i++; out +=' '; rgb[2]+=3; if(rgb[2]>0xF){ rgb[1]+=3; if(rgb[1]>(j===0 ? 6:0xF)){ rgb[0]+=3; if(rgb[0]>0xF){ if(j===0){ j=1; rgb[0]=0; rgb[1]=9; rgb[2]=0; }else{ break; }}else{ rgb[1]=(j < 1 ? 0:9); rgb[2]=0; }}else{ rgb[2]=0; }} } thead.addClass('more_colors').empty().html(out+' '); jQuery('#'+id+'_colorPreview').attr('colspan', 9); jQuery('#'+id+'_colorOriginal').attr('colspan', 9); } jQuery('#'+id+' table.colorPickerTable thead td') .css({ 'width':'12px', 'height':'14px', 'border':'1px solid #000', 'cursor':'pointer' }); e.preventDefault(); return false; }); jQuery(document.createElement("div")) .attr("id", id+"_Bg") .click(function(e){ "use strict"; jQuery("#"+id+"_Bg").fadeOut(500); jQuery("#"+id).fadeOut(500); e.preventDefault(); return false; }) .appendTo("body"); jQuery('#'+id+' table.colorPickerTable thead td') .css({ 'width':'12px', 'height':'14px', 'border':'1px solid #000', 'cursor':'pointer' }); jQuery('#'+id+' table.colorPickerTable') .css({'border-collapse':'collapse'}); jQuery('#'+id) .css({ 'border':'1px solid #ccc', 'background':'#333', 'padding':'5px', 'color':'#fff', 'z-index':999999 }); jQuery('#'+id+'_colorPreview') .css({'height':'50px'}); return id; } function themerex_color_picker_show(id, fld, func){ "use strict"; if(id===null||id===''){ id=jQuery('.iColorPickerTable').attr('id'); } var eICP=fld.offset(); var w=jQuery('#'+id).width(); var h=jQuery('#'+id).height(); var l=eICP.left + w < jQuery(window).width()-10 ? eICP.left:jQuery(window).width()-10 - w; var t=eICP.top + fld.outerHeight() + h < jQuery(document).scrollTop() + jQuery(window).height()-10 ? eICP.top + fld.outerHeight():eICP.top - h - 13; jQuery("#"+id) .data({field: fld, func: func}) .css({ 'top':t+"px", 'left':l+"px", 'position':'absolute', 'z-index':100001 }) .fadeIn(500); jQuery("#"+id+"_Bg") .css({ 'position':'fixed', 'z-index':100000, 'top':0, 'left':0, 'width':'100%', 'height':'100%' }) .fadeIn(500); var def=fld.val().substr(0, 1)=='#' ? fld.val():themerex_rgb2hex(fld.css('backgroundColor')); jQuery('#'+id+'_colorPreview input,#'+id+'_colorOriginal input').val(def); jQuery('#'+id+'_colorPreview,#'+id+'_colorOriginal').css('background',def); } function themerex_get_cookie(name){ "use strict"; var defa=arguments[1]!=undefined ? arguments[1]:null; var start=document.cookie.indexOf(name + '='); var len=start + name.length + 1; if((!start)&&(name!=document.cookie.substring(0, name.length))){ return defa; } if(start==-1) return defa; var end=document.cookie.indexOf(';', len); if(end==-1) end=document.cookie.length; return unescape(document.cookie.substring(len, end)); } function themerex_set_cookie(name, value, expires, path, domain, secure){ "use strict"; var expires=arguments[2]!=undefined ? arguments[2]:0; var path=arguments[3]!=undefined ? arguments[3]:'/'; var domain=arguments[4]!=undefined ? arguments[4]:''; var secure=arguments[5]!=undefined ? arguments[5]:''; var today=new Date(); today.setTime(today.getTime()); if(expires){ expires=expires * 1000 * 60 * 60 * 24; } var expires_date=new Date(today.getTime() + (expires)); document.cookie=name + '=' + escape(value) + ((expires) ? ';expires=' + expires_date.toGMTString():'') + ((path) ? ';path=' + path:'') + ((domain) ? ';domain=' + domain:'') + ((secure) ? ';secure':''); } function themerex_del_cookie(name, path, domain){ "use strict"; var path=arguments[1]!=undefined ? arguments[1]:'/'; var domain=arguments[2]!=undefined ? arguments[2]:''; if(themerex_get_cookie(name)) document.cookie=name + '=' + ((path) ? ';path=' + path:'') + ((domain) ? ';domain=' + domain:'') + ';expires=Thu, 01-Jan-1970 00:00:01 GMT'; } function themerex_clear_listbox(box){ "use strict"; for (var i=box.options.length-1; i>=0; i--) box.options[i]=null; } function themerex_add_listbox_item(box, val, text){ "use strict"; var item=new Option(); item.value=val; item.text=text; box.options.add(item); } function themerex_del_listbox_item_by_value(box, val){ "use strict"; for (var i=0; i temp_opts[y].text){ temp=temp_opts[x]; temp_opts[x]=temp_opts[y]; temp_opts[y]=temp; }} } for(var i=0; i 0&&val.length < opt.rules[i].min_length.value){ if(error_msg=='') jQuery(this).get(0).focus(); error_msg +='

' + (typeof(opt.rules[i].min_length.message)!='undefined' ? opt.rules[i].min_length.message:opt.error_message_text) + '

' error=true; }} if((!error||!opt.exit_after_first_error)&&typeof(opt.rules[i].max_length)=='object'){ if(opt.rules[i].max_length.value > 0&&val.length > opt.rules[i].max_length.value){ if(error_msg=='') jQuery(this).get(0).focus(); error_msg +='

' + (typeof(opt.rules[i].max_length.message)!='undefined' ? opt.rules[i].max_length.message:opt.error_message_text) + '

' error=true; }} if((!error||!opt.exit_after_first_error)&&typeof(opt.rules[i].mask)=='object'){ if(opt.rules[i].mask.value!=''){ var regexp=new RegExp(opt.rules[i].mask.value); if(!regexp.test(val)){ if(error_msg=='') jQuery(this).get(0).focus(); error_msg +='

' + (typeof(opt.rules[i].mask.message)!='undefined' ? opt.rules[i].mask.message:opt.error_message_text) + '

' error=true; }} } if((!error||!opt.exit_after_first_error)&&typeof(opt.rules[i].equal_to)=='object'){ if(opt.rules[i].equal_to.value!=''&&val!=jQuery(jQuery(this).get(0).form[opt.rules[i].equal_to.value]).val()){ if(error_msg=='') jQuery(this).get(0).focus(); error_msg +='

' + (typeof(opt.rules[i].equal_to.message)!='undefined' ? opt.rules[i].equal_to.message:opt.error_message_text) + '

' error=true; }} if(opt.error_fields_class!='') jQuery(this).toggleClass(opt.error_fields_class, error); }} }); if(error_msg!=''&&opt.error_message_show){ var error_message_box=form.find(".result"); if(error_message_box.length==0) error_message_box=form.parent().find(".result"); if(error_message_box.length==0){ form.append('
'); error_message_box=form.find(".result"); } if(opt.error_message_class) error_message_box.toggleClass(opt.error_message_class, true); error_message_box.html(error_msg).fadeIn(); setTimeout(function(){ error_message_box.fadeOut(); }, opt.error_message_time); } return error_msg!=''; } function themerex_document_animate_to(id){ if(id.indexOf('#')==-1) id='#' + id; var obj=jQuery(id).eq(0); if(obj.length==0) return; var oft=jQuery(id).offset().top; var st=jQuery(window).scrollTop(); var speed=Math.min(1600, Math.max(400, Math.round(Math.abs(oft-st) / jQuery(window).height() * 100))); jQuery('body,html').animate({scrollTop: oft - jQuery('#wpadminbar').height() - jQuery('header.fixedTopMenu .topWrap').height()}, speed, 'swing'); } function themerex_document_set_location(curLoc){ try { history.pushState(null, null, curLoc); return; } catch(e){} location.href=curLoc; } function themerex_add_hidden_elements_handler(key, handler){ themerex_set_global_array('init_hidden_elements', key, handler); } function themerex_init_hidden_elements(cont){ if(THEMEREX_GLOBALS['init_hidden_elements']){ for (key in THEMEREX_GLOBALS['init_hidden_elements']){ THEMEREX_GLOBALS['init_hidden_elements'][key](cont); }} } function themerex_browser_is_mobile(){ var check=false; (function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm(os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s)|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp(i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac(|\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt(|\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg(g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v)|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v)|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-|)|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))check=true})(navigator.userAgent||navigator.vendor||window.opera); return check; } function themerex_browser_is_ios(){ return navigator.userAgent.match(/iPad|iPhone|iPod/i)!=null; } function themerex_get_file_name(path){ path=path.replace(/\\/g, '/'); var pos=path.lastIndexOf('/'); if(pos >=0) path=path.substr(pos+1); return path; } function themerex_get_file_ext(path){ var pos=path.lastIndexOf('.'); path=pos >=0 ? path.substr(pos+1):''; return path; } function themerex_check_images_complete(cont){ var complete=true; cont.find('img').each(function(){ if(!complete) return; if(!jQuery(this).get(0).complete) complete=false; }); return complete; }; jQuery(document).ready(function(){ "use strict"; THEMEREX_GLOBALS['theme_init_counter']=0; themerex_init_actions(); }); function themerex_init_actions(){ "use strict"; if(THEMEREX_GLOBALS['vc_edit_mode']&&jQuery('.vc_empty-placeholder').length==0&&THEMEREX_GLOBALS['theme_init_counter']++ < 30){ setTimeout(themerex_init_actions, 200); return; } themerex_ready_actions(); themerex_resize_actions(); themerex_scroll_actions(); jQuery(window).resize(function(){ "use strict"; themerex_resize_actions(); }); jQuery(window).scroll(function(){ "use strict"; themerex_scroll_actions(); }); } function themerex_ready_actions(){ "use strict"; (function ($){ $(function (){ if(!!$.prototype.styler){ $('#fbuilder input, .sc_contact_form input, .variations_form .variations select, .topic, #fbuilder select.field').styler(); }}); })(jQuery); if(jQuery(window).width() >=959){ jQuery('.sc_section.stylization > .sc_section_wrap').each(function (){ var width=jQuery(this).width(); jQuery(this).height(width); }); } if(window.themerex_skin_ready_actions) themerex_skin_ready_actions(); jQuery('.widget_area ul > li').each(function(){ if(jQuery(this).find('ul').length > 0){ jQuery(this).addClass('has_children'); }}); jQuery('.widget_archive a').each(function(){ var val=jQuery(this).html().split(' '); if(val.length > 1){ val[val.length-1]='' + val[val.length-1] + ''; jQuery(this).html(val.join(' ')) }}); jQuery('.widget_calendar').on('click', '.month_prev a, .month_next a', function(e){ "use strict"; var calendar=jQuery(this).parents('.wp-calendar'); var m=jQuery(this).data('month'); var y=jQuery(this).data('year'); var pt=jQuery(this).data('type'); jQuery.post(THEMEREX_GLOBALS['ajax_url'], { action: 'calendar_change_month', nonce: THEMEREX_GLOBALS['ajax_nonce'], month: m, year: y, post_type: pt }).done(function(response){ var rez=JSON.parse(response); if(rez.error===''){ calendar.parent().fadeOut(200, function(){ jQuery(this).find('.wp-calendar').remove(); jQuery(this).append(rez.data).fadeIn(200); }); }}); e.preventDefault(); return false; }); jQuery('.video_background').each(function(){ var youtube=jQuery(this).data('youtube-code'); if(youtube){ jQuery(this).tubular({videoId: youtube}); }}); jQuery('.menu_main_wrap ul#menu_main').clone().removeAttr('id').removeClass('menu_main_nav').addClass('menu_main_responsive').insertAfter('.menu_main_wrap ul#menu_main'); jQuery('.menu_main_responsive_button').click(function(e){ "use strict"; jQuery('.menu_main_responsive').slideToggle(); e.preventDefault(); return false; }); jQuery('.menu_main_wrap .menu_main_responsive li a').click(function(e){ "use strict"; if(jQuery('body').hasClass('responsive_menu')&&jQuery(this).parent().hasClass('menu-item-has-children')){ if(jQuery(this).siblings('ul:visible').length > 0) jQuery(this).siblings('ul').slideUp().parent().removeClass('opened'); else jQuery(this).siblings('ul').slideDown().parent().addClass('opened'); } if(jQuery(this).attr('href')=='#'||(jQuery('body').hasClass('responsive_menu')&&jQuery(this).parent().hasClass('menu-item-has-children'))){ e.preventDefault(); return false; }}); themerex_init_sfmenu('.menu_main_wrap ul#menu_main, .menu_user_wrap ul#menu_user'); if(THEMEREX_GLOBALS['menu_slider']){ jQuery('#menu_main').spasticNav({ }); } if(THEMEREX_GLOBALS['toc_menu']!='no'){ themerex_build_page_toc(); } jQuery('#toc, .menu_main_wrap ul li, .menu_user_wrap ul#menu_user li').on('click', 'a', function(e){ "use strict"; var href=jQuery(this).attr('href'); if(href===undefined) return; var pos=href.indexOf('#'); if(pos < 0||href.length==1) return; if(jQuery(href.substr(pos)).length > 0){ var loc=window.location.href; var pos2=loc.indexOf('#'); if(pos2 > 0) loc=loc.substring(0, pos2); var now=pos==0; if(!now) now=loc==href.substring(0, pos); if(now){ themerex_document_animate_to(href.substr(pos)); themerex_document_set_location(pos==0 ? loc + href:href); e.preventDefault(); return false; }} }); THEMEREX_GLOBALS['top_panel_height']=0; //Math.max(0, jQuery('.top_panel_wrap').height()); jQuery('.pager_cur').click(function(e){ "use strict"; jQuery('.pager_slider').slideDown(300, function(){ themerex_init_shortcodes(jQuery('.pager_slider').eq(0)); }); e.preventDefault(); return false; }); jQuery('#viewmore_link').click(function(e){ "use strict"; if(!THEMEREX_GLOBALS['viewmore_busy']&&!jQuery(this).hasClass('viewmore_empty')){ jQuery(this).parent().addClass('loading'); THEMEREX_GLOBALS['viewmore_busy']=true; jQuery.post(THEMEREX_GLOBALS['ajax_url'], { action: 'view_more_posts', nonce: THEMEREX_GLOBALS['ajax_nonce'], page: THEMEREX_GLOBALS['viewmore_page']+1, data: THEMEREX_GLOBALS['viewmore_data'], vars: THEMEREX_GLOBALS['viewmore_vars'] }).done(function(response){ "use strict"; var rez=JSON.parse(response); jQuery('#viewmore_link').parent().removeClass('loading'); THEMEREX_GLOBALS['viewmore_busy']=false; if(rez.error===''){ var posts_container=jQuery('.content').eq(0); if(posts_container.find('.isotope_wrap').length > 0) posts_container=posts_container.find('.isotope_wrap').eq(0); if(posts_container.hasClass('isotope_wrap')){ posts_container.data('last-width', 0).append(rez.data); THEMEREX_GLOBALS['isotope_init_counter']=0; themerex_init_appended_isotope(posts_container, rez.filters); } else jQuery('#viewmore').before(rez.data); THEMEREX_GLOBALS['viewmore_page']++; if(rez.no_more_data==1){ jQuery('#viewmore_link').addClass('viewmore_empty').parent().hide(); } themerex_init_post_formats(); themerex_init_shortcodes(posts_container); themerex_scroll_actions(); }}); } e.preventDefault(); return false; }); jQuery('.woocommerce .mode_buttons a,.woocommerce-page .mode_buttons a').click(function(e){ "use strict"; var mode=jQuery(this).hasClass('woocommerce_thumbs') ? 'thumbs':'list'; jQuery.cookie('themerex_shop_mode', mode, {expires: 365, path: '/'}); jQuery(this).siblings('input').val(mode).parents('form').get(0).submit(); e.preventDefault(); return false; }); jQuery('body').bind('added_to_cart', function(){ var total=jQuery('.menu_user_cart .total .amount').text() if(total!=undefined){ jQuery('.cart_button .cart_total').text(total); }}); /* jQuery('.menu_user_wrap .popup_link').addClass('inited').click(function(e){ var popup=jQuery(jQuery(this).attr('href')); if(popup.length===1){ themerex_hide_popup(jQuery(popup.hasClass('popup_login') ? '.popup_registration':'.popup_login')); themerex_toggle_popup(popup); } e.preventDefault(); return false; }); */ jQuery('.popup_wrap .popup_close').click(function(e){ var popup=jQuery(this).parent(); if(popup.length===1){ themerex_hide_popup(popup); } e.preventDefault(); return false; }); jQuery('.cart_button').click(function (e){ "use strict"; if(jQuery('body').hasClass('openCart')){ jQuery(this).next('.sidebar_cart').fadeOut(200); jQuery('.cart_overflow').fadeOut(400); jQuery('body').removeClass('openCart'); }else{ jQuery(this).next('.sidebar_cart').fadeIn(200); jQuery('body').addClass('openCart'); if(jQuery('.cart_overflow').length==0){ jQuery('body').append('
') } jQuery('.cart_overflow').fadeIn(400); } e.preventDefault(); return false; }); jQuery(document).on('click', '.cart_overflow', function (e){ "use strict"; jQuery('.cart_overflow').fadeOut(400); jQuery('.cart .sidebar_cart').fadeOut(200); jQuery('body').removeClass('openCart'); }); jQuery('.popup_form.login_form').submit(function(e){ "use strict"; var rez=themerex_login_validate(jQuery(this)); if(!rez) e.preventDefault(); return rez; }); jQuery('.popup_form.registration_form').submit(function(e){ "use strict"; var rez=themerex_registration_validate(jQuery(this)); if(!rez) e.preventDefault(); return rez; }); jQuery("form#commentform").submit(function(e){ "use strict"; var rez=themerex_comments_validate(jQuery(this)); if(!rez) e.preventDefault(); return rez; }); jQuery('.bookmarks_add').click(function(e){ "use strict"; var title=window.document.title.split('|')[0]; var url=window.location.href; var list=jQuery.cookie('themerex_bookmarks'); var exists=false; if(list){ list=JSON.parse(list); for (var i=0; i'+THEMEREX_GLOBALS['strings']['bookmark_title']+'
', THEMEREX_GLOBALS['strings']['bookmark_add'], null, function(btn, popup){ "use strict"; if(btn!=1) return; title=message_popup.find('#bookmark_title').val(); list.push({title: title, url: url}); jQuery('.bookmarks_list').append('
  • '+title+'
  • '); jQuery.cookie('themerex_bookmarks', JSON.stringify(list), {expires: 365, path: '/'}); setTimeout(function (){themerex_message_success(THEMEREX_GLOBALS['strings']['bookmark_added'], THEMEREX_GLOBALS['strings']['bookmark_add']);}, THEMEREX_GLOBALS['message_timeout']/4); }); } else themerex_message_warning(THEMEREX_GLOBALS['strings']['bookmark_exists'], THEMEREX_GLOBALS['strings']['bookmark_add']); e.preventDefault(); return false; }); jQuery('.bookmarks_list').on('click', '.bookmarks_delete', function(e){ "use strict"; var idx=jQuery(this).parent().index(); var list=jQuery.cookie('themerex_bookmarks'); if(list){ list=JSON.parse(list); list.splice(idx, 1); jQuery.cookie('themerex_bookmarks', JSON.stringify(list), {expires: 365, path: '/'}); } jQuery(this).parent().remove(); e.preventDefault(); return false; }); jQuery('.scroll_to_top').click(function(e){ "use strict"; jQuery('html,body').animate({ scrollTop: 0 }, 'slow'); e.preventDefault(); return false; }); themerex_show_system_message(); themerex_init_post_formats(); themerex_init_shortcodes(jQuery('body').eq(0)); if(window.themerex_init_hidden_elements) themerex_init_hidden_elements(jQuery('body').eq(0)); fitLargerHeight(); } function themerex_scroll_actions(){ "use strict"; var scroll_offset=jQuery(window).scrollTop(); var scroll_to_top_button=jQuery('.scroll_to_top'); var adminbar_height=Math.max(0, jQuery('#wpadminbar').height()); if(THEMEREX_GLOBALS['top_panel_height']==0) THEMEREX_GLOBALS['top_panel_height']=jQuery('.top_panel_wrap').height(); if(window.themerex_skin_scroll_actions) themerex_skin_scroll_actions(); if(scroll_offset > THEMEREX_GLOBALS['top_panel_height']) scroll_to_top_button.addClass('show'); else scroll_to_top_button.removeClass('show'); if(!jQuery('body').hasClass('responsive_menu')&&THEMEREX_GLOBALS['menu_fixed']){ var slider_height=0; if(jQuery('.top_panel_below .slider_wrap').length > 0){ slider_height=jQuery('.top_panel_below .slider_wrap').height(); if(slider_height < 10){ slider_height=jQuery('.slider_wrap').hasClass('.slider_fullscreen') ? jQuery(window).height():THEMEREX_GLOBALS['slider_height']; }} if(scroll_offset <=slider_height + THEMEREX_GLOBALS['top_panel_height']){ if(jQuery('body').hasClass('top_panel_fixed')){ jQuery('body').removeClass('top_panel_fixed'); }}else if(scroll_offset > slider_height + THEMEREX_GLOBALS['top_panel_height']){ if(!jQuery('body').hasClass('top_panel_fixed')){ jQuery('.top_panel_fixed_wrap').height(THEMEREX_GLOBALS['top_panel_height']); jQuery('.top_panel_wrap').css('marginTop', '-150px').animate({'marginTop': 0}, 500); jQuery('body').addClass('top_panel_fixed'); }} } jQuery('#toc .toc_item').each(function(){ "use strict"; var id=jQuery(this).find('a').attr('href'); var pos=id.indexOf('#'); if(pos < 0||id.length==1) return; var loc=window.location.href; var pos2=loc.indexOf('#'); if(pos2 > 0) loc=loc.substring(0, pos2); var now=pos==0; if(!now) now=loc==href.substring(0, pos); if(!now) return; var off=jQuery(id).offset().top; var id_next=jQuery(this).next().find('a').attr('href'); var off_next=id_next ? jQuery(id_next).offset().top:1000000; if(off < scroll_offset + jQuery(window).height()*0.8&&scroll_offset + THEMEREX_GLOBALS['top_panel_height'] < off_next) jQuery(this).addClass('current'); else jQuery(this).removeClass('current'); }); themerex_infinite_scroll() themerex_parallax_scroll(); themerex_animation_shortcodes(); } function themerex_infinite_scroll(){ "use strict"; if(THEMEREX_GLOBALS['viewmore_busy']) return; var infinite=jQuery('#viewmore.pagination_infinite'); if(infinite.length > 0){ var viewmore=infinite.find('#viewmore_link:not(.viewmore_empty)'); if(viewmore.length > 0){ if(jQuery(window).scrollTop() + jQuery(window).height() + 100 >=infinite.offset().top){ viewmore.eq(0).trigger('click'); }} }} function themerex_parallax_scroll(){ jQuery('.sc_parallax').each(function(){ var windowHeight=jQuery(window).height(); var scrollTops=jQuery(window).scrollTop(); var offsetPrx=Math.max(jQuery(this).offset().top, windowHeight); if(offsetPrx <=scrollTops + windowHeight){ var speed=Number(jQuery(this).data('parallax-speed')); var xpos=jQuery(this).data('parallax-x-pos'); var ypos=Math.round((offsetPrx - scrollTops - windowHeight) * speed + (speed < 0 ? windowHeight*speed:0)); jQuery(this).find('.sc_parallax_content').css('backgroundPosition', xpos+' '+ypos+'px'); jQuery(this).find('div.sc_video_bg').css('top', ypos+'px'); }}); } function themerex_resize_actions(){ "use strict"; if(jQuery(window).width() >=959){ jQuery('.sc_section.stylization > .sc_section_wrap').each(function (){ var width=jQuery(this).width(); jQuery(this).height(width); }); } if(window.themerex_skin_resize_actions) themerex_skin_resize_actions(); themerex_responsive_menu(); themerex_video_dimensions(); themerex_resize_video_background(); themerex_resize_fullscreen_slider(); fitLargerHeight(); } function themerex_responsive_menu(){ if(themerex_is_responsive_need(THEMEREX_GLOBALS['menu_responsive'])){ if(!jQuery('body').hasClass('responsive_menu')){ jQuery('body').removeClass('top_panel_fixed').addClass('responsive_menu'); jQuery('.menu_main_wrap .content_wrap').append(jQuery('.menu_main_wrap .menu_main_nav_area')); if(jQuery('body').hasClass('menu_relayout')) jQuery('body').removeClass('menu_relayout menu_left').addClass('menu_right'); if(jQuery('ul.menu_main_nav').hasClass('inited')){ jQuery('ul.menu_main_nav').removeClass('inited').superfish('destroy'); }} }else{ if(jQuery('body').hasClass('responsive_menu')){ jQuery('body').removeClass('responsive_menu'); jQuery('.menu_main_responsive').hide(); themerex_init_sfmenu('ul.menu_main_nav'); jQuery('.menu_main_wrap .menu_main').prepend(jQuery('.menu_main_wrap .menu_main_nav_area')); jQuery('.menu_main_nav_area').show(); } if(themerex_is_responsive_need(THEMEREX_GLOBALS['menu_relayout'])){ if(jQuery('body').hasClass('menu_right')){ jQuery('body').removeClass('menu_right').addClass('menu_relayout menu_left'); }}else{ if(jQuery('body').hasClass('menu_relayout')){ jQuery('body').removeClass('menu_relayout menu_left').addClass('menu_right'); }} } if(!jQuery('.menu_main_wrap').hasClass('menu_show')) jQuery('.menu_main_wrap').addClass('menu_show'); } function themerex_is_responsive_need(max_width){ "use strict"; var rez=false; if(max_width > 0){ var w=window.innerWidth; if(w==undefined){ w=jQuery(window).width()+(jQuery(window).height() < jQuery(document).height()||jQuery(window).scrollTop() > 0 ? 16:0); } rez=max_width > w; } return rez; } function themerex_video_dimensions(){ jQuery('.sc_video_frame').each(function(){ "use strict"; var frame=jQuery(this).eq(0); var player=frame.parent(); var ratio=(frame.data('ratio') ? frame.data('ratio').split(':'):(frame.find('[data-ratio]').length>0 ? frame.find('[data-ratio]').data('ratio').split(':'):[16,9])); ratio=ratio.length!=2||ratio[0]==0||ratio[1]==0 ? 16/9:ratio[0]/ratio[1]; var w_attr=frame.data('width'); var h_attr=frame.data('height'); if(!w_attr||!h_attr){ return; } var percent=(''+w_attr).substr(-1)=='%'; w_attr=parseInt(w_attr); h_attr=parseInt(h_attr); var w_real=Math.min(percent ? 10000:w_attr, frame.parents('div,article').width()), //player.width(); h_real=Math.round(percent ? w_real/ratio:w_real/w_attr*h_attr); if(parseInt(frame.attr('data-last-width'))==w_real) return; if(percent){ frame.height(h_real); }else{ frame.css({'width': w_real+'px', 'height': h_real+'px'}); } frame.attr('data-last-width', w_real); }); jQuery('video.sc_video,video.wp-video-shortcode').each(function(){ "use strict"; var video=jQuery(this).eq(0); var ratio=(video.data('ratio')!=undefined ? video.data('ratio').split(':'):[16,9]); ratio=ratio.length!=2||ratio[0]==0||ratio[1]==0 ? 16/9:ratio[0]/ratio[1]; var mejs_cont=video.parents('.mejs-video'); var frame=video.parents('.sc_video_frame'); var w_attr=frame.length>0 ? frame.data('width'):video.data('width'); var h_attr=frame.length>0 ? frame.data('height'):video.data('height'); if(!w_attr||!h_attr){ w_attr=video.attr('width'); h_attr=video.attr('height'); if(!w_attr||!h_attr) return; video.data({'width': w_attr, 'height': h_attr}); } var percent=(''+w_attr).substr(-1)=='%'; w_attr=parseInt(w_attr); h_attr=parseInt(h_attr); var w_real=Math.round(mejs_cont.length > 0 ? Math.min(percent ? 10000:w_attr, mejs_cont.parents('div,article').width()):video.width()), h_real=Math.round(percent ? w_real/ratio:w_real/w_attr*h_attr); if(parseInt(video.attr('data-last-width'))==w_real) return; if(mejs_cont.length > 0&&mejs){ themerex_set_mejs_player_dimensions(video, w_real, h_real); } if(percent){ video.height(h_real); }else{ video.attr({'width': w_real, 'height': h_real}).css({'width': w_real+'px', 'height': h_real+'px'}); } video.attr('data-last-width', w_real); }); jQuery('video.sc_video_bg').each(function(){ "use strict"; var video=jQuery(this).eq(0); var ratio=(video.data('ratio')!=undefined ? video.data('ratio').split(':'):[16,9]); ratio=ratio.length!=2||ratio[0]==0||ratio[1]==0 ? 16/9:ratio[0]/ratio[1]; var mejs_cont=video.parents('.mejs-video'); var container=mejs_cont.length>0 ? mejs_cont.parent():video.parent(); var w=container.width(); var h=container.height(); var w1=Math.ceil(h*ratio); var h1=Math.ceil(w/ratio); if(video.parents('.sc_parallax').length > 0){ var windowHeight=jQuery(window).height(); var speed=Number(video.parents('.sc_parallax').data('parallax-speed')); var h_add=Math.ceil(Math.abs((windowHeight-h)*speed)); if(h1 < h + h_add){ h1=h + h_add; w1=Math.ceil(h1 * ratio); }} if(h1 < h){ h1=h; w1=Math.ceil(h1 * ratio); } if(w1 < w){ w1=w; h1=Math.ceil(w1 / ratio); } var l=Math.round((w1-w)/2); var t=Math.round((h1-h)/2); if(parseInt(video.attr('data-last-width'))==w1) return; if(mejs_cont.length > 0){ themerex_set_mejs_player_dimensions(video, w1, h1); mejs_cont.css({'left': -l+'px', 'top': -t+'px'}); } else video.css({'left': -l+'px', 'top': -t+'px'}); video.attr({'width': w1, 'height': h1, 'data-last-width':w1}).css({'width':w1+'px', 'height':h1+'px'}); if(video.css('opacity')==0) video.animate({'opacity': 1}, 3000); }); jQuery('iframe').each(function(){ "use strict"; var iframe=jQuery(this).eq(0); var ratio=(iframe.data('ratio')!=undefined ? iframe.data('ratio').split(':'):(iframe.find('[data-ratio]').length>0 ? iframe.find('[data-ratio]').data('ratio').split(':'):[16,9])); ratio=ratio.length!=2||ratio[0]==0||ratio[1]==0 ? 16/9:ratio[0]/ratio[1]; var w_attr=iframe.attr('width'); var h_attr=iframe.attr('height'); var frame=iframe.parents('.sc_video_frame'); if(frame.length > 0){ w_attr=frame.data('width'); h_attr=frame.data('height'); } if(!w_attr||!h_attr){ return; } var percent=(''+w_attr).substr(-1)=='%'; w_attr=parseInt(w_attr); h_attr=parseInt(h_attr); var w_real=frame.length > 0 ? frame.width():iframe.width(), h_real=Math.round(percent ? w_real/ratio:w_real/w_attr*h_attr); if(parseInt(iframe.attr('data-last-width'))==w_real) return; iframe.css({'width': w_real+'px', 'height': h_real+'px'}); }); } function themerex_resize_video_background(){ var bg=jQuery('.video_bg'); if(bg.length < 1) return; if(THEMEREX_GLOBALS['media_elements_enabled']&&bg.find('.mejs-video').length==0){ setTimeout(themerex_resize_video_background, 100); return; } var video=bg.find('video'); var ratio=(video.data('ratio')!=undefined ? video.data('ratio').split(':'):[16,9]); ratio=ratio.length!=2||ratio[0]==0||ratio[1]==0 ? 16/9:ratio[0]/ratio[1]; var w=bg.width(); var h=bg.height(); var w1=Math.ceil(h*ratio); var h1=Math.ceil(w/ratio); if(h1 < h){ h1=h; w1=Math.ceil(h1 * ratio); } if(w1 < w){ w1=w; h1=Math.ceil(w1 / ratio); } var l=Math.round((w1-w)/2); var t=Math.round((h1-h)/2); if(bg.find('.mejs-container').length > 0){ themerex_set_mejs_player_dimensions(bg.find('video'), w1, h1); bg.find('.mejs-container').css({'left': -l+'px', 'top': -t+'px'}); } else bg.find('video').css({'left': -l+'px', 'top': -t+'px'}); bg.find('video').attr({'width': w1, 'height': h1}).css({'width':w1+'px', 'height':h1+'px'}); } function themerex_set_mejs_player_dimensions(video, w, h){ if(mejs){ for (var pl in mejs.players){ if(mejs.players[pl].media.src==video.attr('src')){ if(mejs.players[pl].media.setVideoSize){ mejs.players[pl].media.setVideoSize(w, h); } mejs.players[pl].setPlayerSize(w, h); mejs.players[pl].setControlsSize(); }} }} function themerex_resize_fullscreen_slider(){ var slider_wrap=jQuery('.slider_wrap.slider_fullscreen'); if(slider_wrap.length < 1) return; var slider=slider_wrap.find('.sc_slider_swiper'); if(slider.length < 1) return; var h=jQuery(window).height() - jQuery('#wpadminbar').height() - (jQuery('body').hasClass('top_panel_above')&&!jQuery('body').hasClass('.top_panel_fixed') ? jQuery('.top_panel_wrap').height():0); slider.height(h); } function themerex_init_sfmenu(selector){ jQuery(selector).show().each(function(){ if(themerex_is_responsive_need()&&jQuery(this).attr('id')=='menu_main') return; jQuery(this).addClass('inited').superfish({ delay: 200, animation: { opacity: 'show' }, animationOut: { opacity: 'hide' }, speed: THEMEREX_GLOBALS['css_animation'] ? 300:(THEMEREX_GLOBALS['menu_slider'] ? 300:200), speedOut: THEMEREX_GLOBALS['css_animation'] ? 300:(THEMEREX_GLOBALS['menu_slider'] ? 300:200), autoArrows: false, dropShadows: false, onBeforeShow: function(ul){ if(jQuery(this).parents("ul").length > 1){ var w=jQuery(window).width(); var par_offset=jQuery(this).parents("ul").offset().left; var par_width=jQuery(this).parents("ul").outerWidth(); var ul_width=jQuery(this).outerWidth(); if(par_offset+par_width+ul_width > w-20&&par_offset-ul_width > 0) jQuery(this).addClass('submenu_left'); else jQuery(this).removeClass('submenu_left'); } if(THEMEREX_GLOBALS['css_animation']){ jQuery(this).removeClass('animated fast '+THEMEREX_GLOBALS['menu_animation_out']); jQuery(this).addClass('animated fast '+THEMEREX_GLOBALS['menu_animation_in']); }}, onBeforeHide: function(ul){ if(THEMEREX_GLOBALS['css_animation']){ jQuery(this).removeClass('animated fast '+THEMEREX_GLOBALS['menu_animation_in']); jQuery(this).addClass('animated fast '+THEMEREX_GLOBALS['menu_animation_out']); }} }); }); } function themerex_build_page_toc(){ "use strict"; var toc='', toc_count=0; jQuery('[id^="toc_"],.sc_anchor').each(function(idx){ "use strict"; var obj=jQuery(this); var id=obj.attr('id'); var url=obj.data('url'); var icon=obj.data('icon'); if(!icon) icon='icon-record'; var title=obj.attr('title'); var description=obj.data('description'); var separator=obj.data('separator'); toc_count++; toc +='
    ' +(description ? '
    '+description+'
    ':'') +''+(title ? ''+title+'':'')+'' +'
    '; }); if(toc_count > (THEMEREX_GLOBALS['toc_menu_home'] ? 1:0) + (THEMEREX_GLOBALS['toc_menu_top'] ? 1:0)){ if(jQuery('#toc').length > 0) jQuery('#toc .toc_inner').html(toc); else jQuery('body').append('
    '+toc+'
    '); }} function themerex_init_isotope(){ "use strict"; jQuery(window).resize(resizeIsotopeAlternative); var all_images_complete=true; jQuery('.isotope_wrap:not(.inited)').each(function (){ "use strict"; all_images_complete=all_images_complete&&themerex_check_images_complete(jQuery(this)); }); if(!all_images_complete&&THEMEREX_GLOBALS['isotope_init_counter']++ < 30){ setTimeout(themerex_init_isotope, 200); return; } jQuery('.isotope_filters:not(.inited)').addClass('inited').on('click', 'a', function(e){ "use strict"; jQuery(this).parents('.isotope_filters').find('a').removeClass('active'); jQuery(this).addClass('active'); var selector=jQuery(this).data('filter'); jQuery(this).parents('.isotope_filters').siblings('.isotope_wrap').eq(0).isotope({ filter: selector }); if(selector=='*') jQuery('#viewmore_link').fadeIn(); else jQuery('#viewmore_link').fadeOut(); e.preventDefault(); return false; }); jQuery('.isotope_wrap:not(.inited)').each(function(){ "use strict"; var isotope_container=jQuery(this); themerex_init_shortcodes(isotope_container); if(isotope_container.parents('.sc_scroll').length > 0){ isotope_container.addClass('inited').find('.isotope_item').animate({opacity: 1}, 200, function (){ jQuery(this).addClass('isotope_item_show'); }); return; } if(isotope_container.hasClass('alternative')){ setTimeout(function (){ isotope_container.addClass('inited').isotope({ itemSelector: '.isotope_item', masonry: { columnWidth: 1 }, animationOptions: { duration: 2000, easing: 'linear', queue: false }}); isotopeResizeGrid(isotope_container, isotope_container.find('.isotope_item')); isotope_container.find('.isotope_item').animate({opacity: 1}, 200, function (){ jQuery(this).addClass('isotope_item_show'); }); }, 500); }else{ setTimeout(function (){ isotope_container.addClass('inited').isotope({ itemSelector: '.isotope_item', animationOptions: { duration: 750, easing: 'linear', queue: false }}); isotope_container.find('.isotope_item').animate({opacity: 1}, 200, function (){ jQuery(this).addClass('isotope_item_show'); }); }, 500); }}); } function themerex_init_appended_isotope(posts_container, filters){ "use strict"; if(posts_container.parents('.sc_scroll_horizontal').length > 0) return; if(!themerex_check_images_complete(posts_container)&&THEMEREX_GLOBALS['isotope_init_counter']++ < 30){ setTimeout(function(){ themerex_init_appended_isotope(posts_container, filters); }, 200); return; } var flt=posts_container.siblings('.isotope_filter'); for (var i in filters){ if(flt.find('a[data-filter=".flt_'+i+'"]').length==0){ flt.append(''+filters[i]+''); }} themerex_init_shortcodes(posts_container); var elems=posts_container.find('.isotope_item:not(.isotope_item_show)'); if(posts_container.hasClass('alternative')){ resizeIsotopeAlternative(); } setTimeout(function(){ posts_container.isotope('appended', elems); elems.animate({opacity: 1}, 200, function (){ jQuery(this).addClass('isotope_item_show'); }); }, 500); } function themerex_init_post_formats(){ "use strict"; themerex_init_media_elements(jQuery('body')); if(jQuery('.isotope_wrap:not(.inited)').length > 0){ THEMEREX_GLOBALS['isotope_init_counter']=0; themerex_init_isotope(); } if(THEMEREX_GLOBALS['popup_engine']=='pretty'){ jQuery("a[href$='jpg'],a[href$='jpeg'],a[href$='png'],a[href$='gif']").attr('rel', 'prettyPhoto'+(THEMEREX_GLOBALS['popup_gallery'] ? '[slideshow]':'')); var images=jQuery("a[rel*='prettyPhoto']:not(.inited):not([data-rel*='pretty']):not([rel*='magnific']):not([data-rel*='magnific'])").addClass('inited'); try { images.prettyPhoto({ social_tools: '', theme: 'facebook', deeplinking: false }); } catch (e){};}else if(THEMEREX_GLOBALS['popup_engine']=='magnific'){ jQuery("a[href$='jpg'],a[href$='jpeg'],a[href$='png'],a[href$='gif']").attr('rel', 'magnific'); var images=jQuery("a[rel*='magnific']:not(.inited):not(.prettyphoto):not([rel*='pretty']):not([data-rel*='pretty'])").addClass('inited'); try { images.magnificPopup({ type: 'image', mainClass: 'mfp-img-mobile', closeOnContentClick: true, closeBtnInside: true, fixedContentPos: true, midClick: true, preloader: true, tLoading: THEMEREX_GLOBALS['strings']['magnific_loading'], gallery:{ enabled: THEMEREX_GLOBALS['popup_gallery'] }, image: { tError: THEMEREX_GLOBALS['strings']['magnific_error'], verticalFit: true }}); } catch (e){};} jQuery(".post_item_product .product .images a.woocommerce-main-image:not(.hover_icon)").addClass('hover_icon hover_icon_view'); if(jQuery('.post_counters_likes:not(.inited)').length > 0){ jQuery('.post_counters_likes:not(.inited)') .addClass('inited') .click(function(e){ var button=jQuery(this); var inc=button.hasClass('enabled') ? 1:-1; var post_id=button.data('postid'); var likes=Number(button.data('likes'))+inc; var cookie_likes=themerex_get_cookie('themerex_likes'); if(cookie_likes===undefined||cookie_likes===null) cookie_likes=''; jQuery.post(THEMEREX_GLOBALS['ajax_url'], { action: 'post_counter', nonce: THEMEREX_GLOBALS['ajax_nonce'], post_id: post_id, likes: likes }).done(function(response){ var rez=JSON.parse(response); if(rez.error===''){ if(inc==1){ var title=button.data('title-dislike'); button.removeClass('enabled').addClass('disabled'); cookie_likes +=(cookie_likes.substr(-1)!=',' ? ',':'') + post_id + ','; }else{ var title=button.data('title-like'); button.removeClass('disabled').addClass('enabled'); cookie_likes=cookie_likes.replace(','+post_id+',', ','); } button.data('likes', likes).attr('title', title).find('.post_counters_number').html(likes); themerex_set_cookie('themerex_likes', cookie_likes, 365); }else{ themerex_message_warning(THEMEREX_GLOBALS['strings']['error_like']); }}); e.preventDefault(); return false; }); } if(jQuery('.sc_video_play_button:not(.inited)').length > 0){ jQuery('.sc_video_play_button:not(.inited)').each(function(){ "use strict"; jQuery(this) .addClass('inited') .animate({opacity: 1}, 1000) .click(function (e){ "use strict"; if(!jQuery(this).hasClass('sc_video_play_button')) return; var video=jQuery(this).removeClass('sc_video_play_button hover_icon_play').data('video'); if(video!==''){ jQuery(this).empty().html(video); themerex_video_dimensions(); var video_tag=jQuery(this).find('video'); var w=video_tag.width(); var h=video_tag.height(); themerex_init_media_elements(jQuery(this)); jQuery(this).find('video').css({'width':w, 'height': h}).attr({'width':w, 'height': h}); } e.preventDefault(); return false; }); }); } jQuery('a.tribe-events-read-more,.tribe-events-button,.tribe-events-nav-previous a,.tribe-events-nav-next a,.tribe-events-widget-link a,.tribe-events-viewmore a').addClass('sc_button sc_button_style_filled'); } function themerex_init_media_elements(cont){ if(THEMEREX_GLOBALS['media_elements_enabled']&&cont.find('audio,video').length > 0){ if(window.mejs){ window.mejs.MepDefaults.enableAutosize=false; window.mejs.MediaElementDefaults.enableAutosize=false; cont.find('audio:not(.wp-audio-shortcode),video:not(.wp-video-shortcode)').each(function(){ if(jQuery(this).parents('.mejs-mediaelement').length==0){ var media_tag=jQuery(this); var settings={ enableAutosize: true, videoWidth: -1, videoHeight: -1, audioWidth: '100%', audioHeight: 30, success: function(mejs){ var autoplay, loop; if('flash'===mejs.pluginType){ autoplay=mejs.attributes.autoplay&&'false'!==mejs.attributes.autoplay; loop=mejs.attributes.loop&&'false'!==mejs.attributes.loop; autoplay&&mejs.addEventListener('canplay', function (){ mejs.play(); }, false); loop&&mejs.addEventListener('ended', function (){ mejs.play(); }, false); } media_tag.parents('.sc_audio,.sc_video').addClass('inited sc_show'); }}; jQuery(this).mediaelementplayer(settings); }}); } else setTimeout(function(){ themerex_init_media_elements(cont); }, 400); }} function themerex_show_system_message(){ if(THEMEREX_GLOBALS['system_message']['message']){ if(THEMEREX_GLOBALS['system_message']['status']=='success') themerex_message_success(THEMEREX_GLOBALS['system_message']['message'], THEMEREX_GLOBALS['system_message']['header']); else if(THEMEREX_GLOBALS['system_message']['status']=='info') themerex_message_info(THEMEREX_GLOBALS['system_message']['message'], THEMEREX_GLOBALS['system_message']['header']); else if(THEMEREX_GLOBALS['system_message']['status']=='error'||THEMEREX_GLOBALS['system_message']['status']=='warning') themerex_message_warning(THEMEREX_GLOBALS['system_message']['message'], THEMEREX_GLOBALS['system_message']['header']); }} function themerex_toggle_popup(popup){ if(popup.css('display')!='none') themerex_hide_popup(popup); else themerex_show_popup(popup); } function themerex_show_popup(popup){ if(popup.css('display')=='none'){ if(THEMEREX_GLOBALS['css_animation']) popup.show().removeClass('animated fast '+THEMEREX_GLOBALS['menu_animation_out']).addClass('animated fast '+THEMEREX_GLOBALS['menu_animation_in']); else popup.slideDown(); }} function themerex_hide_popup(popup){ if(popup.css('display')!='none'){ if(THEMEREX_GLOBALS['css_animation']) popup.removeClass('animated fast '+THEMEREX_GLOBALS['menu_animation_in']).addClass('animated fast '+THEMEREX_GLOBALS['menu_animation_out']).delay(500).hide(); else popup.fadeOut(); }} function themerex_comments_validate(form){ "use strict"; form.find('input').removeClass('error_fields_class'); var error=themerex_form_validate(form, { error_message_text: THEMEREX_GLOBALS['strings']['error_global'], error_message_show: true, error_message_time: 4000, error_message_class: 'sc_infobox sc_infobox_style_error', error_fields_class: 'error_fields_class', exit_after_first_error: false, rules: [ { field: 'author', min_length: { value: 1, message: THEMEREX_GLOBALS['strings']['name_empty']}, max_length: { value: 60, message: THEMEREX_GLOBALS['strings']['name_long']}}, { field: 'email', min_length: { value: 7, message: THEMEREX_GLOBALS['strings']['email_empty']}, max_length: { value: 60, message: THEMEREX_GLOBALS['strings']['email_long']}, mask: { value: THEMEREX_GLOBALS['email_mask'], message: THEMEREX_GLOBALS['strings']['email_not_valid']}}, { field: 'comment', min_length: { value: 1, message: THEMEREX_GLOBALS['strings']['text_empty'] }, max_length: { value: THEMEREX_GLOBALS['comments_maxlength'], message: THEMEREX_GLOBALS['strings']['text_long']}} ] }); return !error; } function themerex_login_validate(form){ "use strict"; form.find('input').removeClass('error_fields_class'); var error=themerex_form_validate(form, { error_message_show: true, error_message_time: 4000, error_message_class: 'sc_infobox sc_infobox_style_error', error_fields_class: 'error_fields_class', exit_after_first_error: true, rules: [ { field: "log", min_length: { value: 1, message: THEMEREX_GLOBALS['strings']['login_empty'] }, max_length: { value: 60, message: THEMEREX_GLOBALS['strings']['login_long'] }}, { field: "pwd", min_length: { value: 4, message: THEMEREX_GLOBALS['strings']['password_empty'] }, max_length: { value: 30, message: THEMEREX_GLOBALS['strings']['password_long'] }} ] }); return !error; } function themerex_registration_validate(form){ "use strict"; form.find('input').removeClass('error_fields_class'); var error=themerex_form_validate(form, { error_message_show: true, error_message_time: 4000, error_message_class: "sc_infobox sc_infobox_style_error", error_fields_class: "error_fields_class", exit_after_first_error: true, rules: [ { field: "registration_username", min_length: { value: 1, message: THEMEREX_GLOBALS['strings']['login_empty'] }, max_length: { value: 60, message: THEMEREX_GLOBALS['strings']['login_long'] }}, { field: "registration_email", min_length: { value: 7, message: THEMEREX_GLOBALS['strings']['email_empty'] }, max_length: { value: 60, message: THEMEREX_GLOBALS['strings']['email_long'] }, mask: { value: THEMEREX_GLOBALS['email_mask'], message: THEMEREX_GLOBALS['strings']['email_not_valid'] }}, { field: "registration_pwd", min_length: { value: 4, message: THEMEREX_GLOBALS['strings']['password_empty'] }, max_length: { value: 30, message: THEMEREX_GLOBALS['strings']['password_long'] }}, { field: "registration_pwd2", equal_to: { value: 'registration_pwd', message: THEMEREX_GLOBALS['strings']['password_not_equal'] }} ] }); if(!error){ jQuery.post(THEMEREX_GLOBALS['ajax_url'], { action: 'registration_user', nonce: THEMEREX_GLOBALS['ajax_nonce'], user_name: form.find('#registration_username').val(), user_email: form.find('#registration_email').val(), user_pwd: form.find('#registration_pwd').val() }).done(function(response){ var rez=JSON.parse(response); var result_box=form.find('.result'); if(result_box.length==0) result_box=form.siblings('.result'); result_box.toggleClass('sc_infobox_style_error', false).toggleClass('sc_infobox_style_success', false); if(rez.error===''){ result_box.addClass('sc_infobox sc_infobox_style_success').html(THEMEREX_GLOBALS['strings']['registration_success']); setTimeout(function(){ jQuery('.popup_login_link').trigger('click'); }, 3000); }else{ result_box.addClass('sc_infobox sc_infobox_style_error').html(THEMEREX_GLOBALS['strings']['registration_failed'] + ' ' + rez.error); } result_box.fadeIn().delay(3000).fadeOut(); }); } return false; } function themerex_contact_form_validate(form){ "use strict"; var url=form.attr('action'); if(url=='') return false; form.find('input').removeClass('error_fields_class'); var error=false; var form_custom=form.data('formtype')=='custom'; var form_type=form.data('formtype'); if(form_type=='order'){ error=themerex_form_validate(form, { error_message_show: true, error_message_time: 8000, error_message_class: "sc_infobox sc_infobox_style_error", error_fields_class: "error_fields_class", exit_after_first_error: false, rules: [ { field: "email", min_length: { value: 7, message: THEMEREX_GLOBALS['strings']['email_empty'] }, max_length: { value: 60, message: THEMEREX_GLOBALS['strings']['email_long'] }, mask: { value: THEMEREX_GLOBALS['email_mask'], message: THEMEREX_GLOBALS['strings']['email_not_valid'] }}, { field: "username", min_length: { value: 1, message: THEMEREX_GLOBALS['strings']['username_empty'] }}, { field: "username2", min_length: { value: 1, message: THEMEREX_GLOBALS['strings']['username2_empty'] }}, { field: "company", min_length: { value: 1, message: THEMEREX_GLOBALS['strings']['company_empty'] }}, { field: "address", min_length: { value: 1, message: THEMEREX_GLOBALS['strings']['address_empty'] }}, { field: "city", min_length: { value: 1, message: THEMEREX_GLOBALS['strings']['city_empty'] }}, { field: "zip", min_length: { value: 1, message: THEMEREX_GLOBALS['strings']['zip_empty'] }}, { field: "phone", min_length: { value: 1, message: THEMEREX_GLOBALS['strings']['phone_empty'] }}, { field: "pieces", min_length: { value: 1, message: THEMEREX_GLOBALS['strings']['pieces_empty'] }}, { field: "weight", min_length: { value: 1, message: THEMEREX_GLOBALS['strings']['weight_empty'] }}, { field: "height", min_length: { value: 1, message: THEMEREX_GLOBALS['strings']['height_empty'] }}, { field: "width", min_length: { value: 1, message: THEMEREX_GLOBALS['strings']['width_empty'] }}, { field: "depth", min_length: { value: 1, message: THEMEREX_GLOBALS['strings']['height_empty'] }}, { field: "commodity", min_length: { value: 1, message: THEMEREX_GLOBALS['strings']['commodity_empty'] }} ] }); } else if(!form_custom){ error=themerex_form_validate(form, { error_message_show: true, error_message_time: 4000, error_message_class: "sc_infobox sc_infobox_style_error", error_fields_class: "error_fields_class", exit_after_first_error: false, rules: [ { field: "username", min_length: { value: 1, message: THEMEREX_GLOBALS['strings']['name_empty'] }, max_length: { value: 60, message: THEMEREX_GLOBALS['strings']['name_long'] }}, { field: "email", min_length: { value: 7, message: THEMEREX_GLOBALS['strings']['email_empty'] }, max_length: { value: 60, message: THEMEREX_GLOBALS['strings']['email_long'] }, mask: { value: THEMEREX_GLOBALS['email_mask'], message: THEMEREX_GLOBALS['strings']['email_not_valid'] }}, { field: "subject", min_length: { value: 1, message: THEMEREX_GLOBALS['strings']['subject_empty'] }, max_length: { value: 100, message: THEMEREX_GLOBALS['strings']['subject_long'] }}, { field: "message", min_length: { value: 1, message: THEMEREX_GLOBALS['strings']['text_empty'] }, max_length: { value: THEMEREX_GLOBALS['contacts_maxlength'], message: THEMEREX_GLOBALS['strings']['text_long'] }} ] }); } if(!error&&url!='#'){ jQuery.post(url, { action: "send_contact_form", nonce: THEMEREX_GLOBALS['ajax_nonce'], type: form_type, data: form.serialize() }).done(function(response){ "use strict"; console.log(response); var rez=JSON.parse(response); var result=form.find(".result").toggleClass("sc_infobox_style_error", false).toggleClass("sc_infobox_style_success", false); if(rez.error===''){ form.get(0).reset(); if(form_type=='order') result.addClass("sc_infobox_style_success").html(THEMEREX_GLOBALS['strings']['send_order_complete']); else result.addClass("sc_infobox_style_success").html(THEMEREX_GLOBALS['strings']['send_complete']); }else{ result.addClass("sc_infobox_style_error").html(THEMEREX_GLOBALS['strings']['send_error'] + ' ' + rez.error); } result.fadeIn().delay(3000).fadeOut(); }); } return !error; } function isotopeResizeGrid(itemWrap,item){ "use strict"; var isotopeWrap=itemWrap; var isotopeItem=item; var isotopeItemWidth=300; var isotopeItemHeight=300; if(jQuery(window).width() < 800){ var isotopeItemWidth=120; var isotopeItemHeight=120; } else if(jQuery(window).width() < 1023){ var isotopeItemWidth=200; var isotopeItemHeight=200; } if(jQuery(window).width() > 480){ isotopeItem.each(function (){ var w=jQuery(this).data('width'); var h=jQuery(this).data('height'); jQuery(this).css('width', Math.floor(isotopeWrap.width() / Math.floor(isotopeWrap.width() / isotopeItemWidth)) * w); jQuery(this).css('height', Math.floor(isotopeWrap.width() / Math.floor(isotopeWrap.width() / isotopeItemHeight)) * h); }); } itemWrap.isotope('layout'); } function resizeIsotopeAlternative(){ jQuery('.isotope_wrap').each(function (){ "use strict"; if(jQuery(this).hasClass('alternative')){ var isotopeEll=jQuery(this).find('.isotope_item'); isotopeResizeGrid(jQuery(this),isotopeEll); }}); } function fitLargerHeight(){ if(jQuery('.autoHeight.columns_wrap').length > 0){ jQuery('.autoHeight.columns_wrap').each(function (){ "use strict"; var tallestcolumn=0; var columns=jQuery(this).children("div"); columns.css({"height":"auto"}); columns.each(function (){ var currentHeight=jQuery(this).height(); if(currentHeight > tallestcolumn){ tallestcolumn=currentHeight; }} ); if(jQuery(this).find('.sc_accordion').length > 0){ columns.css({"min-height":tallestcolumn}); }else{ columns.height(tallestcolumn); }}); }};